package com.linktco.prison.config;


import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
import com.linktco.common.constant.CommonConstant;
import com.linktco.common.utils.DocketUtil;
import lombok.AllArgsConstructor;
import org.springblade.core.swagger.EnableSwagger;
import org.springblade.core.swagger.SwaggerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.spring.web.plugins.Docket;
import java.util.Collections;
import java.util.List;

/**
 * Swagger配置类
 *
 * @author http://localhost/doc.html
 * @date : 2022/05/12
 */
@Configuration
@EnableSwagger
@AllArgsConstructor
public class SwaggerModuleConfiguration {

	/**
	 * 引入swagger配置类
	 */
	private final SwaggerProperties swaggerProperties;

	/**
	 * 引入Knife4j扩展类
	 */
	private final OpenApiExtensionResolver openApiExtensionResolver;

	@Bean
	public Docket authDocket() {
		return docket("授权模块", Collections.singletonList(CommonConstant.BASE_PACKAGES + ".auth"));
	}

	@Bean
	public Docket sysDocket() {
		return docket("系统模块", Collections.singletonList(CommonConstant.BASE_PACKAGES + ".system"));
	}

	@Bean
	public Docket resourceDocket() {
		return docket("资源模块", Collections.singletonList(CommonConstant.BASE_PACKAGES + ".resource"));
	}

//	@Bean
//	public Docket paymentDocket() {
//		return docket("微信商户模块", Collections.singletonList(CommonConstant.BASE_PACKAGES + ".payment"));
//	}

	@Bean
	public Docket allowanceDocket() {
		return docket("监狱点名模块", Collections.singletonList(CommonConstant.BASE_PACKAGES + ".prison"));
	}

	private Docket docket(String groupName, List<String> basePackages) {
		return DocketUtil.docket(groupName, basePackages, swaggerProperties, openApiExtensionResolver);
	}



}
